using System;
using System.Data;
using Utils;
using Utils.DatabaseUtils;


namespace DCSLibrary
{
public class OrderDetailUI
{ 
	

	public OrderDetailUI() {}

	public int Add(int orderID, int productID, int quatnity, decimal price)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"OrderDetail_Add",orderID,productID,quatnity,price);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Update(int orderDetailID, int orderID, int productID, int quatnity, decimal price)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"OrderDetail_Update",orderDetailID,orderID,productID,quatnity,price);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Delete(int orderDetailID)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"OrderDetail_Delete",orderDetailID);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int DeleteAll()
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"OrderDetail_DeleteAll");
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public DataSet Get(int orderDetailID)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"OrderDetail_Get",orderDetailID);
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetAll()
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"OrderDetail_GetAll");
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetByOrderID(int orderID)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"OrderDetail_GetByOrderID",orderID);
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetByProductID(int productID)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"OrderDetail_GetByProductID",productID);
			return result;
		}
		catch(Exception e) {return null; }
	}

} 
}
